package com.lipo.springmvc;

import java.io.PrintWriter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.google.gson.Gson;
import com.lipo.mapper.ArticleMapper;
import com.lipo.model.Article;

@Controller
@RequestMapping("/article")
public class ArticleContronller {

	@Autowired
	private ArticleMapper artMapper;
	private Gson gson = new Gson();
	
	@RequestMapping("selectById")
	public void selectArticle(String id,PrintWriter pw){
		Article article = artMapper.selectById(Integer.valueOf(id).intValue());
		pw.println(gson.toJson(article));
	}
	
}
